﻿using System.IO;
using EnvDTE;
using EnvDTE80;
using LazyPlugins.DeclarativeAddinCreator.Helpers;
using Microsoft.VisualStudio.CommandBars;

namespace LazyPlugins.DeclarativeAddinCreator
{
    public abstract class AddinActionBase
    {
        public DTE2 ApplicationObject { get; set; }

        public AddIn AddinInstance { get; set; }


        public CommandBarButton RelatedButton { get; set; }

        protected void SetButtonText(string newText)
        {
            RelatedButton.Caption = newText;
        }
        protected void SetButtonIcon(string iconFileNameWithoutPathOrExtension)
        {
            string iconDir = AddinRegistry.GetIconsDirectory();
            string fileName = Path.Combine(iconDir, iconFileNameWithoutPathOrExtension);
            IconUtils.SetControlPicture(RelatedButton, fileName);
        }


        public abstract void Execute();

        public abstract void OnDisconnect();
    }
}
